﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestJson.aspx.cs" Inherits="WebAppDemo.AjaxPage.TestJson" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../Scripts/jquery-1.8.3.js" type="text/javascript"></script>
    <script type="text/javascript">
        //        $(document).ready(function () {

        function checkForm() {
           var curUrl="<%=Page.ResolveUrl(WebAppDemo.AjaxPage.Commmon.URL)%>";
           alert(curUrl);
            var params = {
                userName: $("#<%=txtName.ClientID %>").val()
            };
            $.ajax({
                type: "Post",
                url: curUrl, ///"Feedback.ashx",
                dataType: "json",
                data: params,
                success: function (data, textStatus) {
                    alert("Info:" + data.Info + "| tetxtStatus:" + textStatus);
                },
                error: function () { }
            });
        }
        //        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <ul>
                <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
            </ul>
            <ul>
                <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return checkForm();" />
            </ul>
        </div>
    </div>
    </form>
</body>
</html>
